package lab01;

/**
 * Created by 其 on 2016/4/10.
 */
public class CalculatorTest {
    public static void main(String[] args) {
        final double TEST1 = 2.7;
        final double TEST2 = 0;
        boolean flag = true;
        Calculator calculator = new Calculator();
        calculator.add(TEST1,TEST2);
        if(calculator.getResult() != TEST1) {
            flag = false;
            System.out.println("test failed 1!");
        }
        calculator.subtract(TEST1,TEST2);
        if(calculator.getResult() != TEST1){
            flag = false;
            System.out.println("test failed 2!");
        }
        calculator.multiply(TEST1,TEST2);
        if(calculator.getResult() != TEST2) {
            flag = false;
            System.out.println("test failed 3!");
        }
        calculator.divide(TEST1,TEST2);
        if(calculator.isFlag() != false) {
            flag = false;
            System.out.println("test failed 4!");
        }
        if(flag)
            System.out.println("test passed!");
    }
}
